package com.yjj.im.ui;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.util.ArrayMap;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;


import com.yjj.im.R;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * Created by taro on 16/4/19.
 */
public class DataListActivity extends AppCompatActivity  {
    RecyclerView mRvDisplay = null;

    List<List<String>> mGroupList = null;
    Map<Integer, String> mHeaderMap = new ArrayMap<Integer, String>();

    LinearLayoutManager mLinearLayout = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_datalist);
        mRvDisplay = (RecyclerView) findViewById(R.id.rv_test);

        mGroupList = new LinkedList<List<String>>();
        mHeaderMap = new ArrayMap<Integer, String>();
        int groupId = 0;
        int count = 0;
        count = groupId + 10;
        for (; groupId < count; groupId++) {
            int childCount = 8;
            List<String> childList = null;
            if (groupId > count / 2) {
                childList = new ArrayList<String>(childCount);
                for (int j = 0; j < childCount; j++) {
                    childList.add("child - " + j);
                }
            }
            mGroupList.add(childList);
            mHeaderMap.put(groupId, "title - " + groupId);
        }


        List<String> itemList = new ArrayList<String>();
        for (int i = 0; i < 10; i++) {
            itemList.add("single child - " + i);
        }




    }



//    @Override
//    public void onItemClick(int groupId, int childId, int position, int viewId, boolean isHeader, View rootView, HeaderRecycleViewHolder holder) {
////        RecyclerView.LayoutManager layoutManager = mRvDisplay.getLayoutManager();
////        if (layoutManager instanceof GridLayoutManager) {
////            ((GridLayoutManager) layoutManager).setSpanCount(2);
////            mRvDisplay.getAdapter().notifyDataSetChanged();
////        }
//        Toast.makeText(this, "groud = " + groupId + "/child = " + childId + "/pos = " + position, Toast.LENGTH_SHORT).show();
//    }
}
